package August;

import java.util.HashMap;
import java.util.Scanner;

public class Day0803 {
    //找出字符串中第一个只出现一次的字符
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        char[] str = s.toCharArray();
        HashMap<Character,Integer> hashMap = new HashMap<>();

        for (int i = 0; i < str.length; i++) {
            if (!hashMap.containsKey(str[i])){
                hashMap.put(str[i],1);
            }else {
                hashMap.put(str[i],hashMap.get(str[i])+1);
            }
        }

        for (int i = 0; i < str.length; i++) {
            if (hashMap.get(str[i]) == 1){
                System.out.println(str[i]);
                break;
            }
            if (i == str.length -1 && hashMap.get(str[i]) != 1){
                System.out.println(-1);
                break;
            }
        }
    }


    //小易的升级之路
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()){
            int n = scanner.nextInt();
            int count = scanner.nextInt();
            int[] nums = new int[n];

            for (int i = 0; i < n; i++) {
                nums[i] = scanner.nextInt();

                if (nums[i] <= count)
                    count = count+nums[i];
                else
                    count = count + fun(count,nums[i]);
            }
            System.out.println(count);
        }
    }

    private static int fun(int count, int num) {
        while (num != 0){
            int res = count % num;
            count = num;
            num = res;
        }
        return count;
    }
}
